/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.money.controller;

import com.money.biz.AdministratorBiz;
import com.money.entity.Administrator;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

/**
 *
 * @author Eason
 */
@Controller
public class AdminLoginController {
   
    @Resource(name="adminBiz")
    private AdministratorBiz adminBiz;

    @RequestMapping(value="/adminLogin.do", method=RequestMethod.POST)
    public ModelAndView adminLogin(Administrator admin,HttpServletRequest request, HttpSession session){
        ModelAndView mav = new ModelAndView();
        boolean pass = adminBiz.validate(admin);
        session.setAttribute("admin", admin);
        System.out.println(admin.getUsername()+"--------"+pass);
        mav.setViewName("admin/main");
        return mav;
    }
}
